Optimal Code Motion

Seminar, Project

Optimal code motion is a compiler optimization technique that aims to reduce redundant calculations, code size, and resource usage by moving computations out of loops (avoiding redundant computation) and into branches (avoiding superfluous computation).

Code motion subsumes many other optimizations such as:

In the project, you will explore a recent development with regard to optimal code motion: Partial Redundancy Elimination in Two Iterative Data Flow Analyses "Knoop et al. proposed the first complete and optimal algorithm, Lazy Code Motion (LCM), which takes four unidirectional data flow analyses. In a recent paper, Roy et al. proposed an algorithm for PRE that uses three iterative data flow analyses. Here, we propose an efficient algorithm for PRE, which takes only two iterative data flow analyses followed by two computation passes over the program."

We will implement the optimal code motion algorithm as part of a optimizing compiler for a toy domain-specific-language using either Lean or Scala.